<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    let testA = '123'
    let testB = 666

    function getName(testA) {
        console.log(window.testA, testA)
    }

    function addTestB() {
        testB++
    }

    function test(testA) {
        getName(testA)
        testB = 888
        addTestB()
        return function () {
            return testB
        }
    }

    console.log(test('321')())
    console.log(window.testB)

    // undefined '321'
    // 889
    // undefined
</script>
</body>
</html>
